package com.hanthink.system.service.impl.message;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.hanthink.common.exception.CustomException;
import com.hanthink.system.domain.message.NewsRecordInfo;
import com.hanthink.system.domain.resourcecall.CallRecordFile;
import com.hanthink.system.mapper.message.MessageMapper;
import com.hanthink.system.mapper.resourcecall.ResourceCalFilelMapper;
import com.hanthink.system.mapper.resourcecall.ResourceCallMapper;
import com.hanthink.system.service.message.IMessageInfoService;

@Service
public class MessageInfoServiceImpl implements IMessageInfoService {

	@Autowired
	private MessageMapper msgMapper;

	@Autowired
	private ResourceCalFilelMapper resourceCalFilelMapper;

	@Autowired
	private ResourceCallMapper resourceCallMapper;

	@Override
	public List<NewsRecordInfo> selectMsgList(NewsRecordInfo info) {
		return msgMapper.selectMsgList(info);
	}

	@Override
	public void updateMsgIsRead(NewsRecordInfo info) {
		msgMapper.updateMsg(info);
		// 更新呼叫信息
		resourceCallMapper.updateCallResource(info.getRelationId());
		throw new CustomException(String.format("更新成功"));
	}

	@Override
	public List<CallRecordFile> queryFilelist(CallRecordFile info) {
		return resourceCalFilelMapper.selectCallRecordFilesByCallId(info);
	}

}
